package demo1enum;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Test {
    public static void main(String[] args) {
        //System.out.println(Constant.BLACK);
        reflectPrivateConstructor();
    }

    public static void reflectPrivateConstructor(){
        try {
            Class<?> c1 = Class.forName("demo1enum.TestEnum");
            Constructor<?> constructor = c1.getDeclaredConstructor(String.class,int.class,double.class,String.class);

            constructor.setAccessible(true);
            TestEnum testEnum = (TestEnum) constructor.newInstance("123",8,9.9,"青色");
            System.out.println(testEnum);

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}
